SPK_NAME = python313-wheels
SPK_VERS = 1.0
SPK_VERS_MAJOR_MINOR = $(word 1,$(subst ., ,$(SPK_VERS))).$(word 2,$(subst ., ,$(SPK_VERS)))
SPK_REV = 1
SPK_ICON = src/python3-pip.png

# Compiler must support std=c++11
UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS) $(ARMv5_ARCHS)

PYTHON_PACKAGE = python313
SPK_DEPENDS = "$(PYTHON_PACKAGE)"

MAINTAINER = SynoCommunity
DESCRIPTION =  Collection of programs for the Python 3.13 programming language.
DESCRIPTION_FRE = Collection of programs for the Python 3.13 programming language.
DESCRIPTION_SPN = Colección de programas para el lenguaje de programación Python 3.13.
STARTABLE = no
DISPLAY_NAME = Python 3.13 Wheels Collection
CHANGELOG = "1. Initial package"

HOMEPAGE = https://www.python.org
LICENSE  = PSF

# Enable debug_info symbols
#GCC_DEBUG_INFO := 1

# IMPORTANT: WHEELS must be initialized before include of spksrc.python.mk
# later additions are ok, but WHEELS must not be empty at this point,
# otherwise the build of WHEELS is skipped
WHEELS += src/requirements-abi3.txt
WHEELS += src/requirements-crossenv.txt
WHEELS += src/requirements-pure.txt

SERVICE_SETUP = src/service-setup.sh

OPTIONAL_DEPENDS += python/numpy
OPTIONAL_DEPENDS += python/pandas
OPTIONAL_DEPENDS += python/scipy

include ../../mk/spksrc.common.mk

# [cryptography]
# Use python/cryptography to generate py36-abi3 limited API
# NOTE: It's not possible to build py36-abi3 limited API using pip due to PEP517
#       To generate py311-py311 regular build use src/requirements-crossenv.txt
DEPENDS += python/cryptography

# [mysqlclient]
DEPENDS += cross/mariadb-connector-c
ENV += MYSQLCLIENT_CFLAGS="$(CFLAGS) -I$(STAGING_INSTALL_PREFIX)/include/mysql -I$(STAGING_INSTALL_PREFIX)/include/mariadb -I$(STAGING_INSTALL_PREFIX)/$(PYTHON_INC_DIR)"
ENV += MYSQLCLIENT_LDFLAGS="$(LDFLAGS)"

# [Pendulum]
# Needs atomic to build
# Serves as maturin type python-wheel.mk example
ifneq ($(findstring $(ARCH),$(ARMv7L_ARCHS)),$(ARCH))
DEPENDS += python/pendulum
endif

# [Pillow]
DEPENDS += python/pillow

# [pycares]
DEPENDS += cross/c-ares
ENV += PYCARES_USE_SYSTEM_LIB=1

# [pycurl]
DEPENDS += cross/curl
ENV += PYCURL_CURL_CONFIG=$(STAGING_INSTALL_PREFIX)/bin/curl-config

# [pydantic-core] 
DEPENDS += python/pydantic-core

# [PyNaCl]
DEPENDS += cross/libsodium
ENV += SODIUM_INSTALL=system

# [PyYAML]
DEPENDS += cross/libyaml

# [rencode]
DEPENDS += python/rencode

# [rpds-py]
# Require environment variables
#   PYO3_CROSS_LIB_DIR=$(STAGING_INSTALL_PREFIX)/lib/
#   PYO3_CROSS_INCLUDE_DIR=$(STAGING_INSTALL_PREFIX)/include/
# Version = 0.24 requires rustc >= 1.82 (qoriq)
# Version = 0.25 requires rustc >= 1.85
ifeq ($(findstring $(ARCH),$(PPC_ARCHS)),$(ARCH))
WHEELS += rpds_py==0.24.0
else
WHEELS += rpds_py==0.25.1
endif

include ../../mk/spksrc.python.mk

# [borgbackup]
# Use OpenSSL path as defined by either
# spksrc.wheel-env.mk or spksrc.python.mk
ENV += BORG_OPENSSL_PREFIX="$(OPENSSL_STAGING_PREFIX)"
ENV += BORG_LIBACL_PREFIX="$(STAGING_INSTALL_PREFIX)"
ENV += BORG_LIBB2_PREFIX="$(STAGING_INSTALL_PREFIX)"
ENV += BORG_LIBLZ4_PREFIX="$(STAGING_INSTALL_PREFIX)"
ENV += BORG_LIBXXHASH_PREFIX="$(STAGING_INSTALL_PREFIX)"
ENV += BORG_LIBZSTD_PREFIX="$(STAGING_INSTALL_PREFIX)"
DEPENDS += cross/attr cross/acl cross/openssl3 cross/lz4 cross/libb2 cross/fuse cross/xxhash cross/zstd
ifeq ($(call version_lt, $(TC_GCC), 5.0),1)
WHEELS_CFLAGS += [borgbackup] -std=c11
endif

# [gevent]
DEPENDS += cross/libev cross/c-ares
ENV += GEVENTSETUP_EMBED_CARES=FALSE
ENV += GEVENTSETUP_EMBED_LIBEV=FALSE
ifeq ($(call version_lt, $(TC_GCC), 4.9),1)
WHEELS += gevent==24.11.1
else
WHEELS += gevent==25.5.1
endif
ifeq ($(call version_lt, $(TC_GCC), 5.0),1)
WHEELS_CFLAGS += [gevent] -std=c11
endif

# [greenlet]
# version >= 3.1: gcc >= 8   (DSM7.1) Mandatory require full c++20 support
# version  = 3.0: gcc >= 4.9 (DSM6, comcerto2k) Mandatory require full c++11 support *** unsupported ***
ifeq ($(call version_ge, $(TC_GCC), 8),1)
WHEELS += greenlet==3.2.3
endif

# [llfuse]
ifeq ($(call version_lt, $(TC_GCC), 5.0),1)
WHEELS_CFLAGS += [llfuse] -std=gnu11
endif

# [lxml]
DEPENDS += cross/libxml2
DEPENDS += cross/libxslt
ifeq ($(call version_lt, $(TC_GCC), 5.0),1)
WHEELS_CFLAGS += [lxml] -std=c11
WHEELS += lxml==5.4.0
else
WHEELS += lxml==6.0.2
endif

# [msgpack]
ifeq ($(call version_lt, $(TC_GCC), 5.0),1)
WHEELS_CFLAGS += [msgpack] -std=c11
endif

# [numpy]
# version == 1.26 -> NOT SUPPORTED WITH PYTHON 3.13
# version >= 2.3  -> Requires gcc >= 9.4 -> DSM-7.2
ifeq ($(call version_gt, $(TC_GCC), 8.4),1)
DEPENDS += python/numpy

# [scipy] - depends on numpy >= 2.x
DEPENDS += python/scipy

# [scipy] - depends on numpy >= 2.x
DEPENDS += python/pandas
endif

# [pycryptodome]
ifeq ($(call version_lt, $(TC_GCC), 5.0),1)
WHEELS_CFLAGS += [pycryptodome] -std=c11
endif

# [pycryptodomex]
ifeq ($(call version_lt, $(TC_GCC), 5.0),1)
WHEELS_CFLAGS += [pycryptodomex] -std=c11
endif

# [pygobject]
ifeq ($(call version_ge, $(TC_GCC), 5.0),1)
DEPENDS += python/pygobject
endif

# [ruamel.yaml.clib]
ifeq ($(call version_lt, $(TC_GCC), 5.0),1)
WHEELS_CFLAGS += [ruamel.yaml.clib] -std=c11
endif
